import paramiko

def fetch_remote_file(hostname, port, username, password, remote_path, local_path):
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect(hostname, port=port, username=username, password=password)

    sftp = ssh.open_sftp()
    sftp.get(remote_path, local_path)
    sftp.close()
    ssh.close()

if __name__ == "__main__":
# 调用函数获取远程文件并保存到本地路径
    fetch_remote_file('mc.vincentzyu233.xyz', 22, 'root', 'Diding2014', '/mnt/data/SSoftwareFiles/nonebot2/qwq-bot-6/src/plugins/qwq-bot-plugins/qwq.txt', '/tmp/qwq/qwq.txt')